<template>
  <div class="undefined">
    <navigationTar></navigationTar>
    <div class="shs_body">
      <h1 class="title">404!!!未找到该页面</h1>
      <p>还有{{ second }}s自动跳转到首页</p>
    </div>
  </div>
</template>

<script>
export default {
  name: "undefinedView",
  data() {
    return {
      second: 5,
      timer: null,
    };
  },
  mounted() {
    let _this = this;
    _this.timer = setInterval(function () {
      _this.second--;
      console.log(_this.second);
      if (_this.second == 0) {
        clearInterval(_this.timer);
        location.href = "/";
      }
    }, 1000);
  },
  beforeDestroy() {
    //销毁之前 清空定时器
    clearInterval(this.timer);
  },
  components: {
    navigationTar: () => import("@/components/navigationTar.vue"),
  },
};
</script>

<style scoped>
.shs_body {
  text-align: center;
  padding: 150px;
}
.title {
  padding: 20px;
}
</style>